Updating Windows
Volume Number: 4
Issue Number: 3
Column Tag: Basic School
Updating Windows in Basic
By Dave Kelly, MacTutor Editorial Board
Dave Kelly is an electrical engineer for General Dynamics in Pomona, where he
is involved in using work stations for hardware design. He is a founding editorial board
member and currently an active board member for MacTutor.
A fresh window lets you see things more clearly. (I like mine in color, but black
& white mode on the Macintosh II sure is faster). I received the following request
from one of our readers which I’m sure others of you would also like to know about:
Q. I am working on an application in ZBasic 4.00 that I hope to release
commercially. Previously I never had to worry about handling update events in a
“correct” manner (in the past I have always reprinted everything on the screen when
I’ve encountered an update event). ZBasic does provide a WINDOW PICTURE statement
that I have not gotten to work to my satisfaction. I have also tried GET and PUT without
much success. I’m obviously doing something wrong. could you show various ways to
handle update events that involve DAs and multiple windows? My application has Edit
Fields and displayed text (i.e. displaying results obtained from values entered in the
edit fields).
A. Yes, there can be some tricky problems associated with refreshing windows
which use edit fields. There is a standard way that refreshing should work. In Pascal
the application should respond by calling BeginUpdate, drawing the window, then call
EndUpdate. The Window Manager section of Inside Macintosh explains how to do this.
That’s fine when using the Macintosh standard GetNextEvent loop, but in ZBasic the
approach must be modified.
The object is to restore any window which gets covered up by another window. If
window 1 is dragged over window 2, then if window 2 is selected it should
automatically be redrawn. Or if only part of window 2 is covered up and window 1 is